package com.example.test.dialogfactory;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import easier.app.x.notifycation.NotificationBuilder;

public class MainActivity72 extends AppCompatActivity {

    private NotificationBuilder mBuilder;

    private Button create00;
    private Button update00;
    private Button cancel00;
    private Button create01;
    private Button update01;
    private Button cancel01;

    public static void start( Context context ) {

        Intent starter = new Intent( context, MainActivity72.class );
        context.startActivity( starter );
    }

    @Override
    protected void onCreate( Bundle savedInstanceState ) {

        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main72 );

        mBuilder = new NotificationBuilder( MainActivity72.this );

        initView();
        initViewAction();
    }

    private void initView() {

        create00 = (Button) findViewById( R.id.create00 );
        update00 = (Button) findViewById( R.id.update00 );
        cancel00 = (Button) findViewById( R.id.cancel00 );
        create01 = (Button) findViewById( R.id.create01 );
        update01 = (Button) findViewById( R.id.update01 );
        cancel01 = (Button) findViewById( R.id.cancel01 );
    }

    private void initViewAction() {

        create00.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                Intent intent = new Intent( v.getContext(), MainActivity70.class );
                mBuilder.build( v.getContext(), R.drawable.a5018, "测试通知0", "测试通知内容0", intent, 0 );
            }
        } );

        update00.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                Intent intent = new Intent( v.getContext(), MainActivity70.class );
                mBuilder.build( v.getContext(), R.drawable.a5018, "测试通知0", "测试通知内容0更新了", intent, 0 );
            }
        } );

        cancel00.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                mBuilder.cancel( v.getContext(), 0 );
            }
        } );

        create01.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                Intent intent = new Intent( v.getContext(), MainActivity70.class );
                mBuilder.build( v.getContext(), R.drawable.a5452, "测试通知1", "测试通知内容1", intent, 1 );
            }
        } );

        update01.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                Intent intent = new Intent( v.getContext(), MainActivity70.class );
                mBuilder.build( v.getContext(), R.drawable.a5452, "测试通知1", "测试通知内容1更新了", intent, 1 );
            }
        } );

        cancel01.setOnClickListener( new OnClickListener() {
            @Override
            public void onClick( View v ) {

                mBuilder.cancel( v.getContext(), 1 );
            }
        } );
    }
}